home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 050 / tpstuff2.arc / DIALER.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-01-31  |  2.4 KB  |  115 lines

  1.  
  2. program dial;
  3.  
  4. {This program is written using Turbo Pascal.  It accepts user input to
  5. dial the Hayes SmartModem 1200.  MS-DOS interrupts are used for RS232
  6. communications, so even though this was written on a Tandy 2k, it shoul
  7. work in the IBM and the host of compatables.  If you have trouble
  8. communicating with the serial port, check and change as needed the
  9. value assigned to DL in talk.  It selects the COM port which runs the modem}
  10.  
  11. {initialize for MS DOS interrupt call}
  12. type
  13.      regipak = record ax,bx,cx,dx,bp,di,ds,es,flags:integer;
  14.      end;
  15.  
  16. var
  17.     dm:byte;
  18.     mypak: regipak;
  19.     ah,al,bh,bl,ch,cl,dh,dl,bph,bpl,dih,dil,dsh,dsl: byte;
  20.     cx,len,ct:integer;
  21.     ir:byte;
  22.     dialit,LAST,NUMBER,personal,prefix:string[40];
  23.     dummy,digit:char;
  24.  
  25. procedure talk;
  26. {Send characters to the modem}
  27. begin
  28.      with mypak do
  29.      begin
  30.      ax := ah shl 8 + al;
  31.      dx := dh shl 8 + dl;
  32.      intr($14,mypak);
  33.      end;
  34. end;
  35.  
  36. procedure send_line;
  37. {Break the number apart and TALK to the modem}
  38. begin
  39.     NUMBER:=CONCAT(prefix,DIALIt,chr(13));
  40.     len:=length(number);
  41.     ct:=1;
  42.       while ct<=len do
  43.           begin
  44.           digit:=copy(number,ct,1);
  45.           al:=ord(digit);
  46.           ah:=1;
  47.           dl:=0;
  48.           talk;
  49.           ct:=ct+1;
  50.        end;
  51. end;
  52.  
  53. procedure setup;
  54. {set communications parameters}
  55. begin
  56.      ah:=0;
  57.      dl:=0;
  58.      al:=131;
  59.      talk;
  60.      ah:=4;
  61.      dl:=0;
  62.      talk;
  63. end;
  64.  
  65. procedure hangup;
  66. {What else, but hang up the modem}
  67. begin
  68.     writeln('Hit any key to hang up modem');
  69.     read(dummy);
  70.     dialit:='h0';
  71.     send_line;
  72. end;
  73.  
  74.  
  75. PROCEDURE MAIN;
  76. {Get the number to dial or special commands}
  77. begin
  78.      setup;
  79.            writeln('');
  80.            write('Number to Dial ( . = quit  [enter] = last number): ');
  81.            readln(dialit);
  82.               if dialit='' then
  83.               begin
  84.               dialit:=last;
  85.               end;
  86.            LAST:=DIALIT;
  87.      if last<>'.' then
  88.      begin
  89. write ('Dialing ');
  90. writeln(dialit);
  91.      send_line;
  92.      hangup;
  93.      end;
  94. end;
  95.  
  96. BEGIN
  97. {Get and store the prefix code and get down to business}
  98. writeln('Enter personal dialing code  (MCI access etc) or [enter] for none');
  99. writeln('This code remains active for the complete dialing session');
  100. readln(personal);
  101. prefix:=concat('ATDT',personal);
  102. clrscr;
  103.      WHILE LAST<>'.' do
  104.      begin
  105.      main;
  106.      end;
  107. last:='ddd';
  108. end.
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.